﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smartee.Modelling.Shapes;
using System.Drawing;

namespace Smartee.Modelling
{
    public class SystemGraphicsDrawer : IVisitor
    {
        System.Drawing.Graphics _graphics;

        public SystemGraphicsDrawer(System.Drawing.Graphics graphics)
        {
            _graphics = graphics;
        }

        public void Visit(Box box)
        {
            if (box.FillColor != Color.Transparent)
                _graphics.FillRectangle(new SolidBrush(box.FillColor), box.Rectangle);

            _graphics.DrawRectangle(new Pen(box.Color, box.LineWidth.EM), box.Rectangle);
        }

        public void Visit(Line line)
        {
            _graphics.DrawLine(new Pen(line.Color, line.LineWidth.EM), line.P1, line.P2);
        }

        public void Visit(Text text)
        {
            _graphics.DrawString(text.String, text.Font, new SolidBrush(text.Color), text.Rectangle);
        }
    }
}
